package com.heima.media.config;

import com.heima.media.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        添加拦截器
        registry.addInterceptor(new UserInterceptor())
//        指定拦截路径，这里指拦截所有的路径
                .addPathPatterns("/**");

    }
}
